<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript">
	function saveinputstock()
	{
		var skustr = $("#skustr").val();
		if(skustr=='')
		{
			alert('请输入SKU信息');
			return false;	
		}
		var tostock = $("#tostock").val();
		if(tostock=='')
		{
			alert('请选择盘点仓库');
			return false;	
		}
		 $.post("/purchase/ajaxbutton", {"op": "savehandinputstock","skustr":skustr,"tostock":tostock},
		  function(data){
			   if(data.code==202)
			  {
			 	alert(data.txt);
			  }else{
				  	  var tmp = '';
					 for (var i = 0; i < data.length; i++) {
					 	tmp+="<tr>";
					 tmp += "<td><input name=\"goods_id[]\" type=\"hidden\" value="+data[i].goods_id+">" + data[i].goods_sku + "</td><td>" + data[i].goods_name + "</td><td>" + data[i].goods_stock + "</td><td>"+data[i].instock+"<input name=\"instock[]\" type=\"hidden\" value="+data[i].instock+"></td><td><input type='text' name='memo[]'><input name=\"tocang[]\" type=\"hidden\" value="+data[i].tostock+"></td>";
					tmp += "</tr>";
					 	
					 }
					 tmp+='  <tr><td  align="center" colspan="8" bgcolor="#FFFFFF"><button type="button" onclick="saveinputstockto()" class="btn btn-primary"> 批量操作 </button> </td> </tr>';
					 $("#showtmptable").show();
					 $("#showtmp").html(tmp);
					 
				}
			  return;
		  },"json");
	}
	
	function saveinputstockto()
	{
		$("#stfomrsearch").submit();
	}
</script>


<title>盘点操作</title>
<body class="withvernav">
<div class="bodywrapper">
{{include file='/public/orderleft.tpl'}}
<div class="centercontent">
  <div class="pageheader notab">
    <h1 class="pagetitle">盘点操作</h1>
    <span class="pagedesc"><br></span>
    <div class="menulist">
    <ul class="profile_summary">
    	<li ><a href="/purchase/inputstock"><span>盘点日志列表</span></a></li>
        <li class="current"><a href="/purchase/handinputstock"><span>盘点操作</span></a></li>
        <li><a href="/factorydetail/ajaxbutton?op=stockGoods"><span>查询仓位商品</span></a></li>
        <li><a href="/factorydetail/ajaxbutton?op=importGoodsStock"><span>导入盘点商品</span></a></li>
	</ul>
  </div>
  </div>
  <!--pageheader-->
  <div id="contentwrapper" class="contentwrapper">
   
    <form class="stdform stdform2" method="get" id="search" action="#">
       
      
       <table class="stdtable" cellspacing="0" cellpadding="0" border="0">
            <thead>
              <tr class="">
                <th colspan="8" class="head1">盘点信息</th>
              </tr>
            </thead>
            <tbody>
          
            <tr class="">
              <td align="right">输入盘点信息</td>
              <td colspan="3" align="left" height="40"><textarea name="skustr" id="skustr" rows="5" cols="10" class="full_input"></textarea><br>一行一个编号，格式:商品编号,库存数量
(例如:S00001,10)
</td>
            </tr>
              <tr class="">
              <td align="right">盘点仓库</td>
              <td colspan="3" align="left" height="40"><select name="tostock" id="tostock" size="1" class="full_input">
              <option value="">请选择</option>
              {{foreach from = $storagelist key=key item=li}}
                <option value="{{$li.id}}">{{$li.storagename}}</option>
              {{/foreach}}
              </select>
</td>
            </tr>
           
            <tr>
                <td  align="center" colspan="2" bgcolor="#FFFFFF">
                 <button type="button" onClick="saveinputstock()" class="btn btn-primary"> 确定 </button>
                 </td>
              </tr>
          </tbody></table>
    </form>
   
    <form class="stdform stdform2" method="post" id="stfomrsearch" action="/purchase/ajaxbutton?op=saveinputstockto">
   <table class="stdtable" cellspacing="0" cellpadding="0" border="0" id="showtmptable" style="display:none">
            <thead>
              <tr class="">
                <th colspan="8" class="head1">信息列表</th>
              </tr>
            </thead>
          <tr class="lbbt">
          <td width="8%" bgcolor="#FEFFF1">SKU</td>
          <td  bgcolor="#FEFFF1">名称</td>
          <td  bgcolor="#FEFFF1">当前库存</td>
          <td  bgcolor="#FEFFF1">盘点数</td>
          <td  bgcolor="#FEFFF1">备注</td>
         
        </tr>
            <tbody id="showtmp">
         </tbody>
        </table>
</form>

</body>
</html>